<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var date = Number(prompt("请输入日期--格式20200603"));
        var year,month,day;
        year = parseInt((date/10000));
        console.log(year);
        month = parseInt(date%10000/100); 
        console.log(month);
        day = parseInt((date%100));
        console.log(day);
        switch(month){
            case 12:
                day += 30;
            case 11:
                day += 31; 
            case 10:
                day += 30;
            case 9:
                day += 31;
            case 8:
                day += 31;
            case 7:
                day += 30;
            case 6:
                day += 31;
            case 5:
                day += 30;
            case 4:
                day += 31;
            case 3:
                if(year%4==0 && year%100!=0 || year%400==0){
                    day += 29;
                }else{
                    day += 28;
                }
            case 2:
                day += 31;   
            break;        
        }
        alert('一共'+day+'天');
    </script>
</body>
</html>